package BZimmerman.AndroidWars;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class AndroidWarsActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mainFunction();
    }
    public void mainFunction(){
    	 final Context gameContext = this;
    	 final Button button = (Button) findViewById(R.id.mainButton);
         
         button.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
            	 activityFunction(gameContext);
             }
         });
    }
    
    public void activityFunction(Context gameContext){
		//This function was made to pass the player class back and forth between 

		setContentView(R.layout.loadingscreen);
		Intent i = new Intent(gameContext, BattleActivity.class);
		i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		// TODO Add extras or a data URI to this intent as appropriate.
		startActivityForResult(i,1);
        //playerStats = gamePanel.passedPlayerStats;
        //infoMenu(playerStats);
	}
	
	@Override
	protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
	    super.onActivityResult(requestCode, resultCode, data);
	    System.out.println(requestCode + " " + resultCode + " " + data);
	    switch(requestCode) {
	    case (1) : {
	      if (resultCode == Activity.RESULT_OK) {
	    	  Log.d("WinBug","Result Returned");

	      }
	      break;
	      
	    } 
	    default:break;
	  }
	    setContentView(R.layout.main);
	    mainFunction();
	}
    
}